<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="ls" uri="/ls-trade-tags"%>
<%@ include file="/common/taglibs.jsp"%>


<html>
<head>
	<title>查看单据</title>
	
	<script type="text/javascript">
		function clickBtn(action,id,e){
			switch(action){
			case "add":
				window.location="order!add.action";
				return;					
				
			case "clear":
				$("#mainForm").attr("action","order.action?clear=true");
				break;

			case "delete": 
				$("#mainForm").attr("action","order!delete.action?order.id="+id);
				break;				
				
			case "search":
				$("#mainForm").attr("action","order.action");
				break;	
				
			case "edit":
				$("#mainForm").attr("action","order!edit.action?order.id="+id);
				break;		
			}
			
			$("#mainForm").submit();
		}	

	</script>
</head>
<body>
  <div class="pageTitle"><s:text name="retail.order.order"/> <s:text name="common.mantenance"/></div>
  
  <s:form id="mainForm" name="mainForm" action="order.action" method="post">
  	
  	<div class="form1">
    	<table border="0" cellspacing="0" cellpadding="0">
	      <tr>
	        <td class="sep" ><img src="../images/spacer.gif" style="width:180px;" /></td>
	        <td class="sep sep2" ><img src="../images/spacer.gif" /></td>
	      </tr>
	      <tr>
	        <td><label class="fLabel"><s:text name="retail.order.order"/> <s:text name="common.name"/></label>
	          <div class="fField">
	            <s:textfield name="order.name" cssStyle="width:150px" cssClass="inputText"/>
	          </div></td>
	      </tr>
	      <tr>
	        <td>&nbsp;</td>
	      </tr>	      
        </table>
        
	    <div class="btnSet btnSetTypeB">
		      <div class="left" >
		      
		        <div class="button" >
		          <div class="left" >
		            <div class="right" >
		              <input class="inputButton" type="button" id="searchBtn" value="<s:text name="common.btn.search"/>" onclick="clickBtn('search');"/>
		            </div>
		          </div>
		        </div>
		        
		        <div class="button" >
		          <div class="left" >
		            <div class="right" >
		              <input class="inputButton" type="button" id="clearBtn" value="<s:text name="common.btn.view.all"/>" onclick="clickBtn('clear');"/>
		            </div>
		          </div>
		        </div>

		        <div class="button" >
		          <div class="left" >
		            <div class="right" >
		              <input class="inputButton" type="button" id="clearBtn" value="<s:text name="common.btn.new"/>" onclick="clickBtn('add','',event);"/>
		            </div>
		          </div>
		        </div>		        
	      </div>
      	</div>
    
	</div>    
   
	<s:if test="%{page!=null&&page.result!=null&&page.result.size()!=0}">
	<div class="sListBorder">
	   <div class="sList">
	     <table width="100%" cellspacing="0" cellpadding="0" border="0" class="sTable">
	       <tbody>
	       <tr>
	         <td style="width: 70px;" class="sTh t"> <s:text name="common.created.date"/></td>
	         <td class="sTh t"><s:text name="retail.order.order"/><s:text name="common.name"/></td>
	         <td class="sTh t"><s:text name="retail.order.description"/></td>
	         <td class="sTh t"><s:text name="retail.order.total.price"/></td>
	         <td class="sTh t">&nbsp;</td>
	       </tr>
	       
	       <s:iterator value="page.result" var="order" status="st">
	       
	      	  <s:set var="trClass" value="'sRow1'"></s:set>
	    	  <s:if test="#st.index%2==0">
	       	 		<s:set var="trClass" value="'sRow2'"></s:set>
		       	 <s:else>
		       	    <s:set var="trClass" value="'sRow1'"></s:set>
		       	 </s:else>
			  </s:if>
			  
		      <tr class="<s:property value='#trClass'/>">
		         <td class="sCell"><s:property value="#order.lastUpdatedDate"/></td>
		         <td class="sCell">
		         	 <a href="#" onclick="clickBtn('edit','<s:property value='#order.id'/>',event)">
		         		<s:property value="#order.name"/>
		        	 </a>
		         </td>
		         <td class="sCell"><s:property value="#order.description"/></td>
		         <td class="sCell"><s:property value='@com.lightsaber.trade.core.common.util.Calc@leaveTwoDigital(#order.totalPrice)'/></td>
				 <td class="sCell buttonCell">
				 	<div class="button sbtn">
                            <div class="left">
                              <div class="right">
                                <input type="button" onclick="clickBtn('edit','<s:property value='#order.id'/>',event)" value="<s:text name='common.btn.edit'/>" name="" id="" class="inputButton">
                              </div>
                            </div>
                    </div>
				 	<div class="button sbtn">
                            <div class="left">
                              <div class="right">
                                <input type="button" onclick="clickBtn('delete','<s:property value='#order.id'/>',event)" value="<s:text name='common.btn.delete'/>" name="" id="" class="inputButton">
                              </div>
                            </div>
                    </div>
                 </td>	
                     
	      	 </tr>		       
	       </s:iterator>
	     </tbody>
	     </table>
	   </div>
	   
	   <ls:paging page="%{page}"></ls:paging>
	 </div>
	</s:if> 

   </s:form>
</body>
</html>